package com.example.controller;


import com.example.service.IClassificationService;
import com.example.service.IProductDetailsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2024-09-09
 */
@RestController
@RequestMapping("/uni-app/classification")
public class ClassificationController {
    @Resource
    IClassificationService classificationService;

    @Resource
    IProductDetailsService productDetailsService;

    @RequestMapping("/list")
    public Object classificationList(@RequestParam("id") Integer id){
        Map<String,Object> map = new HashMap<>();
        map.put("classificationPojo",classificationService.selectAllByCommodityCategory(id));
        map.put("classificationList",classificationService.selectAllByCommodityId(id));
        map.put("product",productDetailsService.listAllByProductDetailsId(id));
        return map;
    }
}